package com.ys.utils.yinsheng.yztdock.util;

import java.text.DecimalFormat;
import java.util.Date;
import java.util.HashMap;

/**
 * 发号器
 */
public class QueuingMake {

    private static final HashMap<String, Integer> MAP = new HashMap<String, Integer>();
    private static final DecimalFormat DECIMALFORMAT = new DecimalFormat("0000");

    public static final Long next() {
        String time = DateUtil.format(new Date(), DateUtil.FormatType.MICROSECONDSID);
        String queuing = time + MD5Helper.getPassword(4);
        return Long.parseLong(queuing);
    }

    public static final String nextNew(int i) {
        int j = i % 1000;
        String indexStr = "";
        if (j < 10) {
            indexStr = "00" + j;
        } else if (j < 100) {
            indexStr = "0" + j;
        } else if (j > 1000) {
            indexStr = (j - j / 1000 * 1000) + "";
        } else {
            indexStr = j + "";
        }
        return indexStr;
    }

}
